<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> MD5 </title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">

 </head>

 <body>
  <?php
  $max = 1000;
  $num_array = array();
  $sql = '';
  $db = new mysqli('localhost', 'root', 'root', 'test');
  if($db->connect_error) {
    die('Connect Errot(' . $db->connect_errno . ') ' . $db->connect_error);
  }
  for($i = 0; $i < $max; $i++) {
    $number = mt_rand(100000,999999);
    if(in_array($number, $num_array)) {
      continue;
    }
    $num_array[] = $number;
    $md5 = md5($number);
    $sql .= "INSERT INTO `md5`(number, md5) VALUES('{$number}','{$md5}');";

  }
  $db->multi_query($sql);
  echo "success!";
  ?>
 </body>
</html>
